// token 3个操作 存储/获取/删除
const HMTT_TOKEN = `heima`
// 1.存储 token
export const setToken = (val) => localStorage.setItem(HMTT_TOKEN, val)
// 获取 token
export const getToken = () => localStorage.getItem(HMTT_TOKEN)
// 删除
export const removeToken = () => localStorage.removeItem(HMTT_TOKEN)


// 已关注栏目 - 本地 3个操作 - 存储/获取/删除
const HMTT_FOLLOW_CATE = 'HMTT_FOLLOW_CATE'
export const setCate = (val) => localStorage.setItem(HMTT_FOLLOW_CATE, JSON.stringify(val))
export const getCate = () => JSON.parse(localStorage.getItem(HMTT_FOLLOW_CATE)) || []
export const removeCate = () => localStorage.removeItem(HMTT_FOLLOW_CATE)

// 未关注栏目
const HMTT_UNFOLLOW_CATE = 'HMTT_UNFOLLOW_CATE'
export const setUnCate = (val) =>
    localStorage.setItem(HMTT_UNFOLLOW_CATE, JSON.stringify(val))
export const getunCate = () => JSON.parse(localStorage.getItem(HMTT_UNFOLLOW_CATE)) || []
export const removeUnCate = () => localStorage.removeItem(HMTT_UNFOLLOW_CATE)

// 存储用户id - 本地 3个操作 - 存储/获取/删除
const HMTT_USER_ID = 'HMTT_USER_ID'
export const setUserId = (val) => localStorage.setItem(HMTT_USER_ID, val)
export const getUserId = () => localStorage.getItem(HMTT_USER_ID)
export const removeUserId = () => localStorage.removeItem(HMTT_USER_ID)

// 搜索历史 - 多个
const HMTT_SEARCH_KEYWORD = 'HMTT_SEARCH_KEYWORD'
export const setSearchKeyword = (val) => localStorage.setItem(HMTT_SEARCH_KEYWORD, JSON.stringify(val))
export const getSearchKeyword = () => JSON.parse(localStorage.getItem(HMTT_SEARCH_KEYWORD)) || []
export const removeSearchKeyword = () => localStorage.removeItem(HMTT_SEARCH_KEYWORD)